package com.neusoft.movie.v_movies.fragment;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.neusoft.movie.v_movies.R;
import com.neusoft.movie.v_movies.adpater.ColUsersListAdapter;
import com.neusoft.movie.v_movies.javabean.UsersBean;
import com.neusoft.movie.v_movies.listener.RetrofitListener;
import com.neusoft.movie.v_movies.model.UsersModel;

import java.util.List;

/**
 * Created by Administrator on 2018/3/15.
 */

public class MyColUserFragment extends BaseFragment implements RetrofitListener<List<UsersBean>> {
    RecyclerView recyclerView;
    private int u_id;

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        setLayout_file(R.layout.fragment_my_col_user);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    void initEvents() {

    }

    @Override
    void initViews() {
        recyclerView = (RecyclerView)view.findViewById(R.id.rV_myuser);
        recyclerView.setLayoutManager(new LinearLayoutManager(this.getActivity()));

    }

    @Override
    void initData() {
        UsersModel usersModel = new UsersModel();
        usersModel.mycolusers(getUser_id(),2,this);

    }



    @Override
    public void onSuccess(List<UsersBean> usersBeen, int flag) {
        ColUsersListAdapter adapter = new ColUsersListAdapter(MyColUserFragment.this.getActivity(),usersBeen);
        recyclerView.setAdapter(adapter);

    }

    @Override
    public void onFailed() {
    }

}
